import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

@Component({
  templateUrl: './maximum-and-minimum.component.html',
})
export class MaximumAndMinimumComponent implements OnInit {
  formGroup: FormGroup;
  max = 100;
  min = 10;

  constructor(private fb: FormBuilder) {}

  ngOnInit(): void {
    this.formGroup = this.fb.group({ value: [10, [Validators.max(this.max), Validators.min(this.min)]] });
  }

  onChange(value) {
    console.log(value);
  }

  modelChange(value) {
    console.log('modelChange', value);
  }
}
